﻿@model IEnumerable<WebVideo.EntityQuestions_MultipleChoice>
@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<script src="@Url.Content("~/Content/cssAdmin/js/plugins/jquery-1.7.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/cssAdmin/js/plugins/jquery-ui-1.8.16.custom.min.js")" type="text/javascript"></script>

<script type="text/javascript">
    function Select(Id)
    {
        var getURL = '@Url.Action("ChonImage", "Questions_MultipleChoice")';
        var IdVideo = '@ViewBag.IdVideo';
        $.get(getURL, { "Id": Id, "IdVideo": IdVideo }, function (data) {
            if (data == "error") //error
            {
                $('#nofError').show();
                $('#nofSuccess').hide();
                $('#msgNofError').text("Không thể thêm");
            }
            else {
                
                $('#Img'+Id).fadeOut();
                $('#nofError').hide();
                $('#nofSuccess').show();
                $('#msgNofSuccess').text("Ok");
            }
        });
        return false;
    }
    function DeleteImage(Id) {
        var getURL = '@Url.Action("DeleteImage", "Questions_MultipleChoice")';
         var IdVideo = '@ViewBag.IdVideo';
         $.get(getURL, { "Id": Id, "IdVideo": IdVideo }, function (data) {
             if (data == "error") //error
             {
                 $('#nofError').show();
                 $('#nofSuccess').hide();
                 $('#msgNofError').text("Không thể Xóa");
             }
             else {

                 $('#ImgD' + Id).fadeOut();
                 $('#nofError').hide();
                 $('#nofSuccess').show();
                 $('#msgNofSuccess').text("Ok");
             }
         });
         return false;
     }
</script>


<div class="maincontentinner">
    <ul class="maintabmenu">
       <li class="current"><a href="@Url.Action("Index", "Video")" >Index</a></li>
    </ul>
    <!--maintabmenu-->
    <div class="notification msgsuccess" style="display: none" id="nofSuccess">
        <a class="close"></a>
        <p id="msgNofSuccess">This is a success message.</p>
    </div>
    <!-- notification msgsuccess -->

    <div class="notification msgerror" style="display: none" id="nofError">
        <a class="close"></a>
        <p id="msgNofError">This is an error message.</p>
    </div>
    <!-- notification msgerror -->

    <div class="contenttitle radiusbottom0">
        <h2 class="table"><span>Chọn câu hỏi cho hình ảnh</span></h2>
    </div>
    <!--contenttitle-->
    <table cellpadding="0" cellspacing="0" border="0" class="stdtable" id="dyntable">
        <colgroup>
            <col class="con0" />
            <col class="con1" />
            <col class="con0" />
            <col class="con1" />
        </colgroup>
       <thead>
            <tr>
                 <th class="head1">Hình ảnh</th>
                <th class="head0">Nội dung</th>
                <th class="head0"></th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <th class="head1">Hình ảnh</th>
                <th class="head0">Nội dung</th>
                <th class="head0"></th>

            </tr>
        </tfoot>
        <tbody>
            @{
                foreach (var item in Model)
                {
                    string idd = "Img" + item.Id.ToString();
                <tr class="gradeX" id ="@idd">
                     <td>
                        @{
                            var imageFile = "~/Content/Images/Video/";
                            if (item.Image != null)
                            {
                                imageFile += @item.Image;
                            }
                            else
                            {
                                imageFile += "no-photo.jpg";
                            }
                        }
                        <img src= "@Url.Content(imageFile)" style="width:100px; height:100px" alt="" />
                    </td>
                    <td>
                        @Html.Raw(item.Des)
                    </td>     
                    <td>
                        <a href="#" title="Chọn" onclick="return Select('@item.Id');">Chọn</a>
                    </td>
                </tr> 
                }                      
            }
        </tbody>
    </table>
    @Html.Action("TracNgiemHinhAnh" ,new { IdVideo = ViewBag.IdVideo});
</div>
<!--maincontentinner-->
<script type="text/javascript"  src="@Url.Content("~/Content/cssAdmin/js/custom/tables.js")" ></script>
<script type="text/javascript"  src="@Url.Content("~/Content/cssAdmin/js/plugins/jquery.dataTables.min.js")" ></script>


